package com.franklin.java.api.mybatis.dom.franklin;

import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlTag;
import org.jetbrains.annotations.NotNull;

import java.util.Optional;

/**
 * @author Franklin
 * @since 2021/8/24 16:55
 */
public class MySelect {

    private String id;

    private XmlTag xmlTag;

    MySelect(@NotNull XmlTag xmlTag) {
        this.xmlTag = xmlTag;
        XmlAttribute idAttr = xmlTag.getAttribute("id");
        this.id = Optional.ofNullable(idAttr)
            .map(XmlAttribute::getValue)
            .orElse("");

    }

    public String getId() {
        return id;
    }

    public XmlTag getXmlTag() {
        return xmlTag;
    }
}
